﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>

    <script src="../../Scripts/jquery-1.6.2.min.js" type="text/javascript"></script>

    <script src="../../Scripts/jQuery.easyValidate.js" type="text/javascript"></script>

</head>
<body>

    <script type="text/javascript">
        $(document).ready(function() {

            //            $.easyValidate.onError = function(message, ug) {
            //                alert(this.attr('id') + "|\r\n" + "group" + ug + "." + message.join("*"));
            //            }

            $("#loginid")
            .vRequire({ errorText: "请输入登录名称", group: "LoginId" })
            .vLength({ min: 3, max: 20, errorText: "登录名长度要做{min}和{max}之间" });


            $("#password").vRequire({ errorText: "请输入密码" });

            $("#confirmPassword").vCompare({ empty: true, target: $("#password"), errorText: "两次密码不一致" });

            $("#checkAll").click(function() {
                $.easyValidate('check');
            });

            $("#disabledButton").click(function() {
                var command = true;
                var text = "disable";
                if ($(this).val() == "disable") {
                    command = false;
                    text = "enable";
                }
                $.easyValidate('enable', command);
                $(this).val(text);

            });
            $("#checkLoginId").click(function() {
                //checkGroup
                $.easyValidate('check', 'LoginId');
                $.easyValidate('check', $("#password"));

            });
        });
    </script>

    <div>
        <button id="checkAll" type="button">
            CheckAll
        </button>
        <input id="disabledButton" type="button" value="disable" />
        <button id="checkLoginId" type="button">
            Check LoginId only</button>
    </div>
    <div>
        LoginId:<input type="text" id="loginid" />
    </div>
    <div>
        Password:<input type="password" id="password" />
    </div>
    <div>
        Confirm Password:<input type="password" id="confirmPassword" />
    </div>
</body>
</html>
